﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MSDAL;

namespace MSBL.Repository
{
    public class SaleRepository
    {
        MSEntities db;
        public SaleRepository()
        {
            db = new MSEntities();
        }

        public List<Sale> GetListOfSale()
        {
            return db
                .Sale
                .ToList();
        }

        public bool SaveSaleToDatabase(Sale sale)
        {
            try
            {
                db.Sale.Add(sale);
                db.SaveChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }

    }
}
